<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>

<body>

<div id="app">

    <input type="text" v-model="n1">
    <select v-model="bol">
        <option value="+">+</option>
        <option value="-">-</option>
        <option value="*">*</option>
        <option value="/">/</option>
    </select>
    <input type="text" v-model="n2">
    <!-- button -->
    <input type="button" value="=" :title="print" @click="button()">
    <ul>
        <div v-model="n3">{{n3}}</div>
    </ul>
</div>


<script>
    var vm = new Vue({
        el:'#app',
        data:{
            n1: '',
            n2: '',
            n3: '',
            bol: '+'
        },
        methods:{
            button() {
                if(this.n1=='' || this.n2 =='') {
                    this.n3 = '请输入数字，这里不能为空'
                }else {
                    switch (this.bol) {
                        case '+':
                            this.n3 = parseInt(this.n1) + parseInt(this.n2) + '     为当前计算的结果'
                            break;
                        case '-':
                            this.n3 = parseInt(this.n1) - parseInt(this.n2) + '     为当前计算的结果'
                            break;
                        case '*':
                            this.n3 = parseInt(this.n1) * parseInt(this.n2) + '     为当前计算的结果'
                            break;
                        case '/':
                            this.n3 = parseInt(this.n1) / parseInt(this.n2) + '     为当前计算的结果'
                            break;
                    }
                }
            }
        }
    });
</script>

</body>
</html>